From d6126ba610f29aecee31eb1cf2310fb97076ee9e Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Mon, 2 May 2016 21:18:14 -0400 Subject: [PATCH] Utilize `if let` construct over single branch `match`. --- src/cargo/util/toml.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cargo/util/toml.rs b/src/cargo/util/toml.rs index 288aa2be5..5e0d3868e 100644 --- a/src/cargo/util/toml.rs +++ b/src/cargo/util/toml.rs @@ -156,9 +156,8 @@ pub fn to_manifest(contents: &[u8], pub fn parse(toml: &str, file: &Path) -> CargoResult { let mut parser = toml::Parser::new(&toml); - match parser.parse() { - Some(toml) => return Ok(toml), - None => {} + if let Some(toml) = parser.parse() { + return Ok(toml); } let mut error_str = format!("could not parse input as TOML\n"); for error in parser.errors.iter() { -- 2.30.2